var t = require;
var e = module;
var o = exports;
Object.defineProperty(o, "__esModule", {value: !0});
var a = t("GameEm"),
    i = t("BaseRoadCatDataCom"),
    n = t("CommonRandom"),
    r = t("CommonTiChuRandom"),
    s = t("AdView"),
    c = (function () {
        function t(t) {
            void 0 === t && (t = 50);
            this.index = 0;
            this.objList = {};
            this.baseNum = 0;
            this.baseNum = t;
        }
        t.prototype.getTempToDlgPosList = function () {
            this.index++;
            this.index = this.index % this.baseNum;
            this.objList[this.index] || (this.objList[this.index] = []);
            this.objList[this.index].length = 0;
            return this.objList[this.index];
        };
        return t;
    })(),
    p = (function () {
        function t() {
            this.managerData = {};
            this.roadInPath = [];
            this.roadOutPath = [];
            this.inTabPath = {};
            this.outTabPath = {};
            this.waitMove = [];
            this.wayLockData = {};
            this.maxRoadCount = 3;
            this.startRoadCount = 0;
            this.curRoadCount = {};
            this.waitRoadCount = 0;
            this.roadInTabPath = new c(80);
        }
        t.prototype.getStartTabCount = function () {
            return this.startRoadCount;
        };
        t.prototype.resetWay = function (t, e, o, a) {
            void 0 === a && (a = !0);
            this.roadOutPath = ParseTool.parseV2List(o.roadOutPath);
            this.roadInPath = ParseTool.parseV2List(o.roadInPath);
            o.waitCook && (this.waitMove = ParseTool.parseV2List(o.waitCook));
            this.inTabPath = ParseTool.parseInTabList(o.tabRoadInPath);
            this.outTabPath = ParseTool.parseInTabList(o.tabRoadOutPath);
            this.startRoadCount = t;
            this.maxRoadCount = e;
            if (a) {
                this.wayLockData = {};
                this.curRoadCount = {};
                for (var i = 0; i < e; i++) this.curRoadCount[i] || (this.curRoadCount[i] = {});
            }
        };
        t.prototype.setUnlockPathTab = function (t, e) {
            if (this.wayLockData) {
                this.wayLockData[t] = e;
                this.curRoadCount[t] || (this.curRoadCount[t] = {});
            }
        };
        t.prototype.getLockTabData = function (t) {
            return this.wayLockData[t];
        };
        t.prototype.getWayCountIndex = function (t, e) {
            void 0 === t && (t = 0);
            void 0 === e && (e = 5);
            var o = TaskLooper.getRoadCsIndex();
            o.index = -1;
            for (var a in this.wayLockData) {
                var i = parseInt(a);
                if (this.getRoadCatCount(i, t) <= 0) {
                    o.cs = t;
                    o.index = i;
                    break;
                }
            }
            return o.index < 0 && e > 0 ? this.getWayCountIndex(t + 1, e - 1) : o;
        };
        t.prototype.getWayCountIndex2 = function (t, e) {
            void 0 === t && (t = 0);
            void 0 === e && (e = 5);
            var o = TaskLooper.getRoadCsIndex();
            o.index = -1;
            for (var a = this.startRoadCount; a < this.maxRoadCount; a++)
                if (this.getRoadCatCount(a, t) <= 0) {
                    o.cs = t;
                    o.index = a;
                    break;
                }
            return o.index < 0 && e > 0 ? this.getWayCountIndex(t + 1, e - 1) : o;
        };
        t.prototype.addWaitCount = function () {
            this.waitRoadCount++;
            return this.waitRoadCount;
        };
        t.prototype.reduceWaitCount = function () {
            this.waitRoadCount--;
        };
        t.prototype.getWaitCount = function () {
            return this.waitRoadCount;
        };
        t.prototype.setRoadCatRoad = function (t, e, o) {
            if (this.curRoadCount[t])
                if (o) {
                    this.curRoadCount[t][e] = 1;
                    0 == e && CacheDataManager.setFoodTab(t, !0);
                } else {
                    0 == e && CacheDataManager.setFoodTab(t, !1);
                    for (var a = Object.keys(this.curRoadCount[t]).length - 1; a >= 0; a--)
                        if (this.curRoadCount[t][a] > 0) {
                            this.curRoadCount[t][a] = 0;
                            break;
                        }
                }
        };
        t.prototype.getRoadCatCount = function (t, e) {
            return this.curRoadCount[t][e] || 0;
        };
        t.prototype.getIndexPath = function (t, e) {
            t = Math.max(0, t - this.startRoadCount);
            var o = this.roadInTabPath.getTempToDlgPosList();
            if (e) {
                var a = this.roadInPath,
                    i = this.inTabPath[t];
                o = ParseTool.getMinPath(o, a, a[0], i[0]);
                o = ParseTool.copyList(o, i, !0);
            } else {
                var n = this.roadOutPath,
                    r = this.outTabPath[t];
                o = ParseTool.copyList(o, r, !1);
                o = ParseTool.getMinPath(o, n, r[0], n[n.length - 1]);
            }
            return o;
        };
        t.prototype.getWaitMove = function () {
            return this.waitMove;
        };
        return t;
    })(),
    l = (function () {
        function t() {
            this.posMinDevToTabPath = new c();
            this.posMinDevPath = new c();
            this.centerPath = new c();
            this.tabDlgPos = {};
            this.tableDlgDirPos = {};
            this.mainPath = [];
            this.devNpcPath = {};
            this.tabNpcPath = {};
            this.centerData = null;
            this.startRoadCount = 0;
            this.allDevIndexKey = [];
            this.sortIndexList = [];
        }
        t.prototype.getListMinDis = function (t, e) {
            var o = 9999;
            if (t.length > 0)
                for (var a = 0; a < t.length; a++) {
                    var i = t[a].sub(e).mag();
                    i < o && (o = i);
                }
            return o;
        };
        t.prototype.moveToMainDis = function (t) {
            return this.getListMinDis(this.mainPath, t);
        };
        t.prototype.resetWay = function (t, e) {
            this.startRoadCount = t;
            this.allDevIndexKey.length = 0;
            CacheDataManager.setGameDirCache(e.roadRoadDir || {}, t);
            this.mainPath = ParseTool.parseV2List(e.mainPath);
            this.devNpcPath = ParseTool.parseInTabList(e.devNpcPath);
            this.tabNpcPath = ParseTool.parseInTabList(e.tabNpcPath);
            for (var o in this.tabNpcPath)
                this.allDevIndexKey.push({
                    index: parseInt(o),
                    pos: cc.v2(this.tabNpcPath[o][this.tabNpcPath[o].length - 1])
                });
            if (e.centerData) {
                this.centerData = {};
                this.centerData.main = ParseTool.parseV2List(e.centerData.main);
                this.centerData.path1 = ParseTool.parseInTabList(e.centerData.path1);
                this.centerData.path2 = ParseTool.parseInTabList(e.centerData.path2);
                e.centerData.pathb && (this.centerData.pathb = ParseTool.parseInTabList(e.centerData.pathb));
            }
        };
        t.prototype.getMaxRandCount = function (t, e) {
            return t >= e ? t - e : t;
        };
        t.prototype.getRoadPos = function (t) {
            if (this.centerData) {
                var e = this.getMaxRandCount(t, this.startRoadCount),
                    o = this.centerData.path2[e];
                return o[o.length - 1];
            }
            var a = this.tabNpcPath[t];
            return a[a.length - 1];
        };
        t.prototype.getMinNpcRoad = function () {};
        t.prototype.getMinNpcTab = function (t) {
            var e = -1;
            if (this.sortIndexList.length != this.allDevIndexKey.length) {
                this.sortIndexList.length = 0;
                for (var o = 0; o < this.allDevIndexKey.length; o++) this.sortIndexList.push(o);
            }
            for (o = 0; o < this.sortIndexList.length; o++) this.sortIndexList[o] = o;
            for (o = 0; o < this.allDevIndexKey.length; o++)
                for (var a = this.allDevIndexKey[o].pos.sub(t).mag(), i = o; i < this.allDevIndexKey.length; i++)
                    if (a > this.allDevIndexKey[i].pos.sub(t).mag()) {
                        var n = this.sortIndexList[o];
                        this.sortIndexList[o] = this.sortIndexList[i];
                        this.sortIndexList[i] = n;
                    }
            for (var r = 0, s = 10; e < 0 && s > 0; ) {
                for (o = 0; o < this.sortIndexList.length; o++) {
                    var c = this.sortIndexList[o],
                        p = this.allDevIndexKey[c];
                    a = p.pos.sub(t).mag();
                    if (CacheDataManager.getFoodTabCount(p.index) <= r) {
                        e = p.index;
                        break;
                    }
                }
                r++;
                s--;
            }
            return e;
        };
        t.prototype.getRoadToDevPath = function (t, e, o) {
            var a = this.devNpcPath[e],
                i = this.tabNpcPath[t];
            console.log("ValueBean -----------------getRoadToDevPath");
            (a && i) || console.log("ValueBean ----------------- 位置没找到");
            var n = this.mainPath,
                r = this.posMinDevPath.getTempToDlgPosList();
            if (o) {
                r = ParseTool.copyList(r, a, !1);
                r = ParseTool.getMinPath(r, n, a[0], i[0]);
                r = ParseTool.copyList(r, i, !0);
            } else {
                r = ParseTool.copyList(r, i, !1);
                r = ParseTool.getMinPath(r, n, i[0], a[0]);
                r = ParseTool.copyList(r, a, !0);
            }
            return r;
        };
        t.prototype.getCenterPath = function (t, e, o) {
            var a = this.centerPath.getTempToDlgPosList();
            if (this.centerData) {
                var i = this.centerData.main,
                    n = this.centerData.path1[t],
                    r = this.centerData.path2[e];
                this.centerData.pathb && this.centerData.pathb[e] && (r = this.centerData.pathb[e]);
                if (o) {
                    a = ParseTool.copyList(a, n, !1);
                    a = ParseTool.getMinPath(a, i, n[0], r[0]);
                    a = ParseTool.copyList(a, r, !0);
                } else {
                    a = ParseTool.copyList(a, r, !1);
                    a = ParseTool.getMinPath(a, i, r[0], n[0]);
                    a = ParseTool.copyList(a, n, !0);
                }
            }
            return a;
        };
        t.prototype.getCenterToPos = function (t, e, o) {
            var a = this.centerPath.getTempToDlgPosList();
            if (this.centerData) {
                var i = this.centerData.main;
                if (o) {
                    var n = this.centerData.path2[e];
                    a = ParseTool.getMinPath(a, i, t, n[0]);
                    a = ParseTool.copyList(a, n, !0);
                } else {
                    var r = this.centerData.path1[e];
                    a = ParseTool.getMinPath(a, i, t, r[0]);
                    a = ParseTool.copyList(a, r, !0);
                }
            }
            return a;
        };
        t.prototype.getMinDevPath = function (t, e) {
            var o = cc.v2(e),
                a = this.devNpcPath[t],
                i = this.posMinDevToTabPath.getTempToDlgPosList();
            i = ParseTool.getMinPath(i, this.mainPath, o, a[0]);
            return ParseTool.copyList(i, a);
        };
        t.prototype.getPath2ToDev = function (t, e) {
            var o = this.centerPath.getTempToDlgPosList();
            if (this.centerData) {
                var a = this.centerData.main,
                    i = this.devNpcPath[e];
                o = ParseTool.getMinPath(o, a, t, i[0]);
                o = ParseTool.copyList(o, i, !0);
            }
            return o;
        };
        t.prototype.getPath2ToDlg = function (t, e) {
            var o = this.centerPath.getTempToDlgPosList();
            if (this.centerData) {
                var a = this.centerData.main,
                    i = this.centerData.path2[e];
                o = ParseTool.getMinPath(o, a, t, i[0]);
                o = ParseTool.copyList(o, i, !0);
            }
            return o;
        };
        t.prototype.getMinNpcTabPath = function (t, e) {
            var o = cc.v2(e);
            if (this.centerData) {
                var a = this.getMaxRandCount(t, this.startRoadCount);
                return this.getCenterToPos(e, a, !0);
            }
            var i = this.posMinDevToTabPath.getTempToDlgPosList(),
                n = this.tabNpcPath[t];
            i = ParseTool.getMinPath(i, this.mainPath, o, n[0]);
            return ParseTool.copyList(i, n, !0);
        };
        return t;
    })(),
    d = (function () {
        function t() {
            this.timeObj = {};
            this.wayRoad = new p();
            this.npcRoad = new l();
            this.cookData = {
                curCatCount: 0,
                curCarCount: 0,
                lastMakeTime: 0,
                canCheckTabTask: !1,
                curNpcCat: 0,
                newNpcType: [],
                tempSaveNpcData: [],
                npcBoxCount: 0,
                tempFoodList: [],
                npcBoxNodePos: {},
                tabIndexKeyData: {},
                roadIndexKeyData: {},
                giftAren: {},
                devAren: {},
                cookDirIndex: {},
                tabGift: {},
                carFirstCarId: -1,
                canCarCooking: !1
            };
            this.cookCofData = {
                baseCatCount: 0,
                addCatCount: 0,
                baseCarCount: 0,
                addCarCount: 0,
                baseNpcCount: 1,
                addNpcCount: 0,
                maxLevel: 0,
                curLevel: 0
            };
            this.managerData = {
                catWay: "",
                npcWay: "",
                callTable: [],
                foodTableList: [],
                rewardTableList: [],
                roadCatTaskList: [],
                npcUseCatStatus: {},
                employeeList: {},
                allNpcKind: [],
                devData: {},
                allFoodKind: null,
                customerData: {},
                customerList: {},
                customerKindCount: {},
                nextCatLimiteTime: 1e3
            };
            this.commonFood = new r.default();
            this.comRand = {};
            this.foodKindRand = {};
            this.npcMakeCount = {};
            this.saveData = {};
            this.isFirst = !0;
        }
        t.prototype.setDevAren = function (t, e) {
            this.cookData.devAren[t] = e;
        };
        t.prototype.getDevAren = function (t) {
            return this.cookData.devAren[t];
        };
        t.prototype.setFoodDir = function (t, e, o) {
            this.cookData.cookDirIndex[t] || (this.cookData.cookDirIndex[t] = {});
            this.cookData.cookDirIndex[t][e] = o;
        };
        t.prototype.getFoodDir = function (t, e) {
            return (this.cookData.cookDirIndex[t] && this.cookData.cookDirIndex[t][e]) || 0;
        };
        t.prototype.addRoadCatWait = function (t, e, o, a) {
            this.managerData.roadCatTaskList.push(this.getRoadWaitObj(t, e, o, a));
            this.setChackTask(!0);
        };
        t.prototype.getRoadWaitObj = function (t, e, o, a) {
            var i = TaskLooper.getRoadObj();
            i.catId = t;
            i.road = e;
            i.cs = o;
            i.aren = a;
            return i;
        };
        t.prototype.closeWayRoad = function (t, e) {
            this.wayRoad.setRoadCatRoad(t, e, !1);
        };
        t.prototype.getCookFoodKind = function (t) {
            var e = TaskLooper.getFoodNeeds(),
                o = this.getFoodCount(t.data.order_type);
            e.foodKindCountList || (e.foodKindCountList = []);
            e.foodKindCountList.length = 0;
            var a = Math.min(Math.max(this.getDevUnlockCount(), 1), o);
            this.resetFood();
            for (var i = 0; i < a; i++) {
                var n = TaskLooper.getFoodIdKind();
                n.id = this.curFoodKind(e.foodKindCountList);
                n.count = this.getFoodKindRand(t.data.order_num);
                n.mul = 1;
                e.foodKindCountList.push(n);
            }
            return e;
        };
        t.prototype.getDevUnlockCount = function () {
            var t = this.managerData.devData.foodLockData,
                e = 0;
            for (var o in t) t[o].length > 1 && t[o][0].isUnLock && e++;
            return e;
        };
        t.prototype.curFoodKind = function (t, e) {
            void 0 === e && (e = 10);
            var o = GameDataValue.getHotTime();
            if (o && o.foodId && Math.random() < 0.7) {
                for (var a = !0, i = 0; i < t.length; i++) t[i].id == o.foodId && (a = !1);
                if (a) return o.foodId;
            }
            var n = this.commonFood.getRandVal();
            if (e > 0) for (i = 0; i < t.length; i++) if (t[i].id == n) return this.curFoodKind(t, e - 1);
            return n;
        };
        t.prototype.resetFood = function () {
            for (var t = this.managerData.allFoodKind.allKey, e = 0; e < t.length; e++)
                (0 == e || (t[e].curlv > 1 && CacheDataManager.haveEquipActive(t[e].key))) &&
                    this.commonFood.addOceVal(t[e].key);
        };
        t.prototype.getFoodCount = function (t) {
            if (!this.comRand[t]) {
                this.comRand[t] = new n.default();
                for (var e = t.split(","), o = 0; o < e.length; o++) this.comRand[t].addVal(parseInt(e[o]), o + 1);
            }
            return this.comRand[t].getRandomVal();
        };
        t.prototype.getFoodKindRand = function (t) {
            if (!this.foodKindRand[t]) {
                this.foodKindRand[t] = new n.default();
                for (var e = t.split(","), o = 0; o < e.length; o++) this.foodKindRand[t].addVal(parseInt(e[o]), o + 1);
            }
            return this.foodKindRand[t].getRandomVal();
        };
        t.prototype.getRoadCatData = function () {
            var t = this.getRoadCatKind(),
                e = this.managerData.customerList[t];
            if (t && e && e.length) {
                var o = TaskLooper.getRoadCatData(),
                    a = e[Math.floor(Math.random() * e.length)];
                o.catKind = t;
                o.data = a;
                o.kindIndex = 0;
                o.roadLine = "0";
                return o;
            }
            return null;
        };
        t.prototype.getRoadCarData = function () {
            var t = this.getRoadCatKind(),
                e = this.managerData.customerList[t];
            if (t && e && e.length) {
                var o = TaskLooper.getRoadCatData(),
                    a = e[Math.floor(Math.random() * e.length)];
                o.catKind = t;
                o.data = a;
                o.kindIndex = 1;
                o.roadLine = "0";
                return o;
            }
            return null;
        };
        t.prototype.getNpcCatData = function () {
            if (this.managerData.allNpcKind.length > 0) {
                var t = this.managerData.allNpcKind.pop(),
                    e = this.managerData.employeeList[t];
                if (t && e && e.length > 0) {
                    var o = TaskLooper.getRoadCatData(),
                        a = Math.floor(Math.random() * e.length),
                        i = e[a];
                    o.catKind = a;
                    o.data = i;
                    o.kindIndex = t;
                    return o;
                }
            }
            return null;
        };
        t.prototype.setTabAren = function (t, e) {
            this.cookData.tabIndexKeyData = t;
            this.cookData.roadIndexKeyData = e;
        };
        t.prototype.getMakeTabIndexKey = function (t) {
            return (this.cookData.tabIndexKeyData && this.cookData.tabIndexKeyData[t]) || "0";
        };
        t.prototype.getRoadCatTabIndexKey = function (t) {
            return (this.cookData.roadIndexKeyData && this.cookData.roadIndexKeyData[t]) || "0";
        };
        t.prototype.getNewNpcBoxPos = function (t, e, o) {
            void 0 === o && (o = 0);
            for (var a = o, i = null; !i; )
                if (this.cookData.npcBoxNodePos[a]) a++;
                else {
                    var n = a % t.maxCount,
                        r = Math.floor(a / t.maxCount);
                    i = cc.v2(this.getIndexPos(t.width, n), -r * t.height);
                    this.cookData.npcBoxNodePos[a] = i;
                    this.cookData.giftAren[a] = e;
                }
            var s = TaskLooper.getPosFoodPos();
            s.id = a;
            s.pos = cc.v2(t.node.position).add(i);
            s.typeIndex = t.giftIndex;
            return s;
        };
        t.prototype.getIndexPos = function (t, e) {
            return (e % 2 == 0 ? -1 : 1) * t * Math.floor((e + 1) / 2);
        };
        t.prototype.removeNpcBoxPos = function (t) {
            this.cookData.npcBoxNodePos[t] = null;
            this.cookData.giftAren[t] = null;
        };
        t.prototype.getRoadCatKind = function () {
            var t = "";
            for (var e in this.managerData.customerKindCount)
                if (this.managerData.customerKindCount[e] > 0) {
                    t = e;
                    break;
                }
            return t;
        };
        t.prototype.setMakeCatCache = function (t, e, o) {
            this.managerData.customerList = e;
            this.managerData.customerKindCount = {};
            for (var a = 0; a < o.length; a++) this.managerData.customerKindCount[o[a]] = 1;
        };
        t.prototype.setBaseCatCount = function (t) {
            this.cookCofData.baseCatCount = t;
        };
        t.prototype.setBaseCarCount = function (t) {
            this.cookCofData.baseCarCount = t;
        };
        t.prototype.setEmployee = function (t, e) {
            this.managerData.employeeList = t;
            this.managerData.allNpcKind = e;
            this.npcMakeCount = {};
        };
        t.prototype.addNpcType = function (t) {
            this.managerData.allNpcKind.push(t);
            this.npcMakeCount[t] = 0;
        };
        t.prototype.getArenCount = function (t) {
            return this.npcMakeCount[t] || 0;
        };
        t.prototype.addArenCount = function (t) {
            this.npcMakeCount[t] = this.getArenCount(t) + 1;
        };
        t.prototype.getCookObj = function (t, e, o, a) {
            var i = TaskLooper.getCookList();
            i.catId = o;
            i.tabIndex = t;
            i.catKind = a;
            i.foodData = e;
            i.overCountView || (i.overCountView = []);
            i.overCountView.length = 0;
            var n = 0;
            i.delayWaitFoodCount || (i.delayWaitFoodCount = []);
            i.catRoadOverCount || (i.catRoadOverCount = []);
            i.viewIdCount || (i.viewIdCount = []);
            i.viewIdCount.length = 0;
            i.delayWaitFoodCount.length = 0;
            i.catRoadOverCount.length = 0;
            for (var r = e.foodKindCountList, s = 0; s < r.length; s++) {
                n += r[s].count;
                var c = TaskLooper.getFoodIdKind();
                c.count = r[s].count;
                c.id = r[s].id;
                c.mul = r[s].mul;
                i.delayWaitFoodCount.push(0);
                i.catRoadOverCount.push(0);
                i.overCountView.push(0);
                i.viewIdCount.push(c);
            }
            i.allCount = n;
            i.reduceTaskCount = 0;
            i.allOverCount = 0;
            return i;
        };
        t.prototype.getWaitFoodObj = function (t, e, o, a, i, n, r) {
            var s = TaskLooper.getWaitFoodList();
            s.catId = t;
            s.foodId = e;
            s.count = o;
            s.tabIndex1 = a;
            s.tabIndex2 = i;
            s.mul = n;
            s.kindIndex = r;
            return s;
        };
        t.prototype.addCookingOver = function (t, e, o, a, i, n, r, s, c, p) {
            void 0 === s && (s = 1);
            void 0 === c && (c = cc.Vec2.ZERO);
            this.managerData.foodTableList.push(this.getWaitFoodObj(n, r, s, a, i, o, e));
            a != i && EvCat.emit(EvCat.updateFoodView, i, c, r, !0, t, p);
            this.setChackTask(!0);
        };
        t.prototype.canRoadCatCanGetFood = function () {
            return this.managerData.foodTableList.length > 0;
        };
        t.prototype.getTabRewardList = function () {
            return this.managerData.rewardTableList.length > 0;
        };
        t.prototype.addInvate = function (t) {
            this.cookData.tempSaveNpcData.length < 1 && this.cookData.newNpcType.push(t);
        };
        t.prototype.addInvateSaveData = function (t) {
            this.cookData.tempSaveNpcData.push(t);
        };
        t.prototype.clearInvateSave = function (t) {
            this.cookData.tempSaveNpcData.length = 0;
            for (var e = 0; e < t.length; e++) delete this.managerData.npcUseCatStatus[t[e]];
        };
        t.prototype.invateDataCount = function () {
            return this.cookData.newNpcType.length > 0;
        };
        t.prototype.getMakeInvate = function () {
            if (this.cookData.newNpcType.length > 0) {
                var t = this.cookData.newNpcType.pop();
                this.addInvateSaveData(t);
                var e = this.managerData.employeeList[0];
                if (e && e.length > 0) {
                    var o = {},
                        a = Math.floor(Math.random() * e.length),
                        i = e[a];
                    o.catKind = a;
                    o.data = i;
                    o.kindIndex = 0;
                    o.invData = t;
                    return o;
                }
            }
            return null;
        };
        t.prototype.getWaitFoodEvData = function () {
            for (var t = null, e = 1, o = 0; o < this.managerData.rewardTableList.length; o++) {
                var a = this.managerData.rewardTableList[o];
                if (a.tabIndex1 == a.tabIndex2) {
                    t = this.managerData.rewardTableList.splice(o, 1)[0];
                    break;
                }
            }
            if (t) {
                e = t.mul;
                this.addRoadGetFoodOver(t.catId, t.foodId, t.count);
                TaskLooper.putWaitFoodObj(t);
            }
            return this.getUpdataCatFoodCount(e);
        };
        t.prototype.setAddTabRewardData = function () {};
        t.prototype.haveCanUEQTab = function () {
            for (var t = 0; t < this.managerData.foodTableList.length; t++) {
                var e = this.managerData.foodTableList[t];
                if (e.tabIndex1 != e.tabIndex2) return !0;
            }
            return !1;
        };
        t.prototype.changeTabData = function () {
            for (var t = 0; t < this.managerData.foodTableList.length; t++) {
                var e = this.managerData.foodTableList[t];
                if (e.tabIndex1 == e.tabIndex2) {
                    this.managerData.rewardTableList.push(e);
                    this.managerData.foodTableList.splice(t, 1);
                    return !0;
                }
            }
            return !1;
        };
        t.prototype.getUpdateFoodView = function () {
            return this.managerData.rewardTableList;
        };
        t.prototype.parseChangeFood = function (t, e) {
            var o = [],
                i = this.wayRoad.getStartTabCount(),
                n = t.tabIndex1 >= i ? t.tabIndex1 - i : t.tabIndex1,
                r = t.tabIndex2,
                s = this.npcRoad.getCenterToPos(e, r, !1),
                c = "" + t.kindIndex,
                p = this.npcRoad.getCenterPath(r, n, !0);
            o.push(
                this.getTaskData(
                    "",
                    c,
                    a.Cat0Index.moveGetFoodData,
                    t.tabIndex1,
                    0,
                    s,
                    t.foodId,
                    t.count,
                    null,
                    0,
                    t.catId,
                    t.tabIndex2
                )
            );
            o.push(
                this.getTaskData2(
                    "",
                    c,
                    a.Cat0Index.removeFoodKind,
                    t.tabIndex1,
                    0,
                    s,
                    t.foodId,
                    t.count,
                    null,
                    0,
                    t.catId,
                    t.tabIndex2,
                    t.mul
                )
            );
            o.push(
                this.getTaskData(
                    "",
                    c,
                    a.Cat0Index.moveWalk,
                    t.tabIndex1,
                    0,
                    p,
                    t.foodId,
                    t.count,
                    null,
                    0,
                    t.catId,
                    t.tabIndex2
                )
            );
            o.push(
                this.getTaskData(
                    "",
                    c,
                    a.Cat0Index.downFood,
                    t.tabIndex1,
                    0,
                    null,
                    t.foodId,
                    t.count,
                    null,
                    0,
                    t.catId,
                    t.tabIndex1
                )
            );
            o.push(this.getNpcContinueWaitTask(""));
            return o;
        };
        t.prototype.getTaskData2 = function (t, e, o, a, i, n, r, s, c, p, l, d, u) {
            void 0 === r && (r = -1);
            void 0 === s && (s = 1);
            void 0 === c && (c = null);
            void 0 === p && (p = 0);
            void 0 === l && (l = -1);
            void 0 === d && (d = -1);
            void 0 === u && (u = 1);
            var h = TaskLooper.getTask();
            h.task = o;
            h.index = a;
            h.cs = i;
            h.path = n;
            h.toId = r;
            h.toId2 = l;
            h.startToPos = c;
            h.waitTime = p;
            h.toTab2Index = d;
            h.count = s;
            h.aren = t;
            h.toAren = e;
            h.cookMul = u;
            return h;
        };
        t.prototype.getTabData = function () {
            for (var t = null, e = 0; e < this.managerData.foodTableList.length; e++) {
                var o = this.managerData.foodTableList[e];
                if (o.tabIndex1 != o.tabIndex2) {
                    if ("1" != o.kindIndex) {
                        t = o;
                        this.managerData.foodTableList.splice(e, 1);
                        break;
                    }
                    if (this.cookData.canCarCooking && this.getCarRoadId() == o.catId) {
                        t = o;
                        this.managerData.foodTableList.splice(e, 1);
                        break;
                    }
                }
            }
            return t;
        };
        t.prototype.setCarCookData = function (t) {
            this.cookData.canCarCooking = t;
        };
        t.prototype.logCard = function () {
            console.log("ValueBean -----------------update 打印");
            console.log("ValueBean -------cookData--update-------- ", this.cookData.canCarCooking, this.getCarRoadId());
        };
        t.prototype.getCarRoadId = function () {
            return this.cookData.carFirstCarId;
        };
        t.prototype.setCarRoadId = function (t) {
            this.cookData.carFirstCarId = t;
        };
        t.prototype.resetCarId = function () {
            this.setCarCookData(!1);
            this.cookData.carFirstCarId = -1;
        };
        t.prototype.getCanChangeFood = function () {
            for (var t = null, e = 1, o = 0; o < this.managerData.foodTableList.length; o++) {
                var a = this.managerData.foodTableList[o];
                if (a.tabIndex1 != a.tabIndex2) {
                    a.tabIndex2, a.tabIndex1;
                    t = this.managerData.foodTableList.splice(o, 1)[0];
                    break;
                }
            }
            if (t) {
                e = t.mul;
                this.addRoadGetFoodOver(t.catId, t.foodId, t.count);
                TaskLooper.putWaitFoodObj(t);
            }
            return this.getUpdataCatFoodCount(e);
        };
        t.prototype.getUpdataCatFoodCount = function (t) {
            for (var e = null, o = 0; o < this.managerData.callTable.length && null == e; o++)
                for (var a = this.managerData.callTable[o], i = a.foodData.foodKindCountList, n = 0; n < i.length; n++)
                    if (a.delayWaitFoodCount[n] < a.catRoadOverCount[n]) {
                        e = TaskLooper.getRoadCatGetFood();
                        a.viewIdCount[n].count = i[n].count - a.catRoadOverCount[n];
                        e.catData = a;
                        e.foodIndex = n;
                        e.mul = t;
                        break;
                    }
            return e;
        };
        t.prototype.resetWaitFoodCount = function (t, e) {
            t.allOverCount += t.catRoadOverCount[e] - t.delayWaitFoodCount[e];
            t.delayWaitFoodCount[e] = t.catRoadOverCount[e];
            return t.allCount <= t.allOverCount;
        };
        t.prototype.recCookingData = function (t) {
            for (var e = 0; e < this.managerData.callTable.length; e++) {
                var o = this.managerData.callTable[e];
                if (o.catId == t) {
                    for (var a = 0; a < o.foodData.foodKindCountList.length; a++)
                        TaskLooper.putFoodIdKind(o.foodData.foodKindCountList[a]);
                    for (a = 0; a < o.viewIdCount.length; a++) TaskLooper.putFoodIdKind(o.viewIdCount[a]);
                    o.viewIdCount.length = 0;
                    o.foodData.foodKindCountList.length = 0;
                    TaskLooper.putFoodNeeds(o.foodData);
                    o.foodData = null;
                    TaskLooper.putCookingObj(this.managerData.callTable.splice(e, 1)[0]);
                    break;
                }
            }
        };
        t.prototype.addRoadGetFoodOver = function (t, e, o) {
            void 0 === o && (o = 1);
            for (var a = !0, i = 0; i < this.managerData.callTable.length && a; i++) {
                var n = this.managerData.callTable[i];
                if (n.catId == t)
                    for (var r = n.foodData.foodKindCountList, s = 0; s < r.length; s++)
                        if (r[s].id == e && n.catRoadOverCount[s] < r[s].count) {
                            this.managerData.callTable[i].catRoadOverCount[s] += o;
                            a = !1;
                        }
            }
            this.setChackTask(!0);
        };
        t.prototype.addTabFoodTask = function (t, e, o, a) {
            var i = this.getCookObj(t, e, o, a);
            this.managerData.callTable.push(i);
            this.setChackTask(!0);
        };
        t.prototype.addFoodDown = function () {};
        t.prototype.getTabFoodDataTask = function () {
            for (var t = [], e = 0; e < this.managerData.callTable.length; e++) {
                var o = this.managerData.callTable[e];
                if (o.allCount > o.reduceTaskCount)
                    for (
                        var n = o.foodData.foodKindCountList,
                            r = o.overCountView,
                            s = function (s) {
                                if (r[s] < n[s].count) {
                                    var p = n[s].id,
                                        l = c.getDevAren(p),
                                        d = c.getTaskNpc(a.Cat0Index.continueWait, l);
                                    if (d < 0) return "continue";
                                    var u = null;
                                    EvCat.emit(EvCat.callCat, d, function (t, e) {
                                        u = e;
                                    });
                                    if (u) {
                                        var h = u.getComponent(i.default),
                                            f = c.parseToCookTask(1, p, cc.v2(u.position), o, d + "", h.getKindIndex());
                                        if (f.length > 0) {
                                            c.managerData.callTable[e].reduceTaskCount += 1;
                                            o.overCountView[s] += 1;
                                            (t = ParseTool.copyList(t, f, !0)).push(d);
                                            return {value: t};
                                        }
                                    }
                                }
                            },
                            c = this,
                            p = 0;
                        p < n.length && p < r.length;
                        p++
                    ) {
                        var l = s(p);
                        if ("object" == typeof l) return l.value;
                    }
            }
            return t;
        };
        t.prototype.parseToCookTask = function (t, e, o, i, n, r) {
            var s = [],
                c = this.wayRoad.getStartTabCount(),
                p = i.catId,
                l = i.tabIndex,
                d = this.getNullFoodDevIndex(e);
            if (d < 0) return s;
            var u = this.getDevAren(e);
            this.setDevUseStatus(d, !0);
            var h = this.getDevIndex(d),
                f = null,
                y = 0.01;
            if (!CacheDataManager.isImMakeFood(n + "", r + "")) {
                y = CacheDataManager.getFoodBaseCd(e, CacheDataManager.getFoodLevel(e));
                y /=
                    1 +
                    (CacheDataManager.getAddAllAddtion(a.AddtionData.allMakefoodSpeedsAdd) +
                        CacheDataManager.getAddCatAddtion(n, r + "", a.AddtionData.allMakefoodSpeedsAdd));
                y = Math.max(0.01, y);
            }
            var v = 0,
                g = null,
                m = this.getFoodDir(e, h);
            if ("0" == u) {
                var _ = (g = this.npcRoad.getMinDevPath(d, o))[Math.floor(g.length / 2)];
                v = l >= c && 0 != c ? this.npcRoad.getMinNpcTab(_) : l;
                f = this.npcRoad.getRoadToDevPath(v, d, !0);
            } else {
                v = l;
                var C = l >= c && 0 != c ? l - c : l;
                g = this.npcRoad.getPath2ToDev(o, d);
                f = this.npcRoad.getPath2ToDlg(g[g.length - 1] || o, C);
            }
            var b = i.catKind;
            this.getCarRoadId() < 0 && this.setCarRoadId(i.catId);
            s.push(this.getTaskData("", b, a.Cat0Index.moveWalk, l, i.cs, g));
            s.push(this.getTaskData("", b, a.Cat0Index.cooking, l, i.cs, null, e, t, null, y, d, m));
            CacheDataManager.setFoodTabCount(v, 1);
            s.push(this.getTaskData("", b, a.Cat0Index.moveWalk, l, i.cs, f, p, 1));
            s.push(this.getTaskData("", b, a.Cat0Index.downFood, l, i.cs, null, e, t, null, 0, p, v));
            s.push(this.getNpcContinueWaitTask(""));
            return s;
        };
        t.prototype.getDevIndex = function (t) {
            var e = 0;
            this.managerData.devData &&
                this.managerData.devData.devData &&
                this.managerData.devData.devData[t] &&
                (e = this.managerData.devData.devData[t].foodIndex);
            return e;
        };
        t.prototype.getToTabCount = function () {
            return Math.floor(Math.random() * this.wayRoad.getStartTabCount());
        };
        t.prototype.setRoadCatOverOnceFood = function () {};
        t.prototype.getNewWpos = function () {
            return cc.v2(0, 0);
        };
        t.prototype.parseToOldJson = function () {};
        t.prototype.resetInit = function (t, e) {
            var o = GameDataValue.getLastLv(),
                a = CacheDataManager.getChapterRoomId(o),
                i = CacheDataManager.getRestaurant(a, o);
            console.log("ValueBean -----------------当前加载level>>>>>>>>>>", i.mode_path);
            var n = CacheDataManager.getLevelRoadPath(i.mode_path);
            this.wayRoad.resetWay(t, e, n);
            this.npcRoad.resetWay(t, n);
        };
        t.prototype.setRoadWayStatus = function (t, e) {
            this.wayRoad.setUnlockPathTab(t, e);
        };
        t.prototype.resetRoadCount = function (t) {
            var e = GameDataValue.getLastLv(),
                o = CacheDataManager.getChapterRoomId(e),
                a = CacheDataManager.getRestaurant(o, e);
            this.wayRoad.resetWay(
                this.wayRoad.getStartTabCount(),
                t,
                CacheDataManager.getLevelRoadPath(a.mode_path),
                !1
            );
        };
        t.prototype.getMapSave = function () {
            this.saveData.npc || (this.saveData.npc = {});
            for (var t in this.saveData.npc) this.saveData.npc[t] = 0;
            this.saveData.npcGift || (this.saveData.npcGift = {});
            for (var t in this.saveData.npcGift) this.saveData.npcGift[t] = 0;
            var e = this.managerData.npcUseCatStatus;
            for (var t in e)
                if (CacheDataManager.isInvateId(t));
                else {
                    var o = e[t].aren;
                    this.saveData.npc[o] || (this.saveData.npc[o] = 0);
                    this.saveData.npc[o]++;
                }
            var a = {};
            for (var t in this.saveData.npc) this.saveData.npc[t] && (a[t] = this.saveData.npc[t]);
            for (var t in this.cookData.giftAren)
                if (this.cookData.giftAren[t]) {
                    o = this.cookData.giftAren[t];
                    this.saveData.npcGift[o] || (this.saveData.npcGift[o] = 0);
                    this.saveData.npcGift[o]++;
                }
            this.saveData.allKey = this.managerData.allFoodKind.allKey;
            this.saveData.equipDataActive = CacheDataManager.getEquipDataActive();
            this.saveData.addCatCount = this.cookCofData.addCatCount;
            this.saveData.addCarCount = this.cookCofData.addCarCount;
            this.saveData.taskOverIndex = CacheDataManager.getTaskSaveData();
            this.saveData.cost = CacheDataManager.getCoinCount();
            this.saveData.maxLevel = this.cookCofData.maxLevel;
            this.saveData.curLevel = this.cookCofData.curLevel;
            this.saveData.addNpcCount = this.cookCofData.addNpcCount;
            this.saveData.tabGift = this.cookData.tabGift;
            this.saveData.foodCdSave = CacheDataManager.getFoodCdSave();
            this.saveData.profitSaveData = CacheDataManager.getProfitSaveData();
            this.saveData.speedsDataSave = CacheDataManager.getSpeedsDataSave();
            return this.saveData;
        };
        t.prototype.setTabNum = function (t, e) {
            this.saveData.tabUnlockValue || (this.saveData.tabUnlockValue = {});
            this.saveData.tabUnlockValue && (this.saveData.tabUnlockValue[t] = e);
        };
        t.prototype.getTabNum = function (t) {
            return (this.saveData.tabUnlockValue && this.saveData.tabUnlockValue[t]) || 0;
        };
        t.prototype.getTabDataBool = function (t) {
            return this.cookData.tabGift[t];
        };
        t.prototype.setTabDataBool = function (t) {
            this.cookData.tabGift[t] = !0;
        };
        t.prototype.parseOldObj = function (t) {
            this.cookCofData.addCatCount = t.addCatCount;
            this.cookCofData.addCarCount = t.addCarCount;
            this.managerData.allNpcKind.length = 0;
            if (Object.keys(t.npc).length > 1)
                for (var e in t.npc)
                    for (var o = t.npc[e], a = 0; a < o; a++)
                        "0" == e && 0 != a ? this.addNpcType("2") : this.addNpcType(e);
            else
                for (var e in t.npc)
                    for (o = t.npc[e], a = 0; a < o; a++)
                        "0" == e && 0 != a ? this.addNpcType("1") : this.addNpcType(e);
            for (var e in t.npcGift) for (o = t.npcGift[e], a = 0; a < o; a++) this.addNpcType(e);
            this.cookData.tabGift = t.tabGift;
            this.cookCofData.addNpcCount = t.addNpcCount || 0;
            CacheDataManager.setEquipDataActive(t.equipDataActive);
            this.cookCofData.addCatCount = 0;
            var i = t.addCatCount || 0;
            this.addRoadCat(i);
            this.cookCofData.addCarCount = 0;
            var n = t.addCarCount || 0;
            this.addRoadCar(n);
            var r = t.allKey;
            for (var e in this.managerData.allFoodKind.allKey)
                this.managerData.allFoodKind.allKey[e] && (this.managerData.allFoodKind.allKey[e].lv = 0);
            for (a = 0; a < r.length; a++) for (var s = r[a].lv || 0, c = 0; c < s; c++) this.unLockFoodLvKey(a + "");
            var p = this.managerData.devData.foodLockData;
            for (var e in p) {
                var l = p[e];
                if (l)
                    for (var d in l)
                        if (l[d].isUnLock) {
                            var u = !CacheDataManager.getEquipDataStatusActive(e, parseInt(d) + 2 + "");
                            l[d].isuse = u;
                        }
            }
            CacheDataManager.setFoodCdSave(t.foodCdSave);
            CacheDataManager.setProfitSaveData(t.profitSaveData);
            CacheDataManager.setSpeedsDataSave(t.speedsDataSave);
        };
        t.prototype.setMaxLevelCount = function (t, e) {
            void 0 === e && (e = 0);
            this.cookCofData.maxLevel = t;
            this.cookCofData.curLevel = e;
        };
        t.prototype.setDevUseStatus = function (t, e) {
            var o = this.managerData.devData.devData,
                a = this.managerData.devData.foodLockData;
            if (o[t]) {
                var i = o[t].foodIndex,
                    n = o[t].foodId;
                if (a[n] && a[n][i] && a[n][i].isUnLock) {
                    a[n][i].isuse = e;
                    this.setChackTask(!0);
                }
            }
        };
        t.prototype.setFoodDevIndexStatus = function (t, e, o) {
            var a = this.managerData.devData.devData,
                i = this.managerData.devData.foodLockData;
            for (var n in a) {
                var r = a[n].foodId;
                if (t == r && i[r] && i[r][e] && i[r][e].isUnLock) {
                    i[r][e].isuse = o;
                    this.setChackTask(!0);
                }
            }
        };
        t.prototype.getDevIdKey = function (t) {
            var e = !1,
                o = this.managerData.devData.devData,
                a = this.managerData.devData.foodLockData,
                i = o[t].foodIndex,
                n = o[t].foodId;
            a[n] && a[n][i] && a[n][i].isUnLock && (e = a[n][i].isuse);
            return e;
        };
        t.prototype.getNullFoodDevIndex = function (t) {
            var e = -1,
                o = this.managerData.devData.foodLockData[t];
            if (o)
                for (var a = 0; a < o.length; a++)
                    if (!o[a].isuse && o[a].isUnLock) {
                        e = o[a].devIndex;
                        break;
                    }
            return e;
        };
        t.prototype.resetDevData = function () {
            var t = {},
                e = this.managerData.allFoodKind.foodData,
                o = {},
                a = {},
                i = {},
                n = {};
            for (var r in e) {
                var s = e[r];
                i[r] || (i[r] = 0);
                n[r] || (n[r] = {});
                for (var c = 0; c < s.length; c++) {
                    var p = s[c].add_equip;
                    if (p) {
                        o[r] ? o[r]++ : (o[r] = 1);
                        n[r][p] = s[c].level;
                    }
                }
            }
            var l = this.getCurDevFoodData(),
                d = 0;
            for (c = 0; c < l.length; c++)
                for (var u = o[(r = l[c])] || 0, h = 0; h < u; h++)
                    if (!t[d]) {
                        t[d] = {};
                        t[d].foodId = r;
                        t[d].devKey = h + 1;
                        t[d].unLockLv = n[r][h + 1];
                        a[r] || (a[r] = []);
                        t[d].foodIndex = a[r].length;
                        a[r].push({isuse: !0, isUnLock: !1, devIndex: d});
                        d++;
                    }
            var f = {};
            f.devCount = o;
            f.devData = t;
            f.foodLockData = a;
            f.foodUnlockCount = i;
            f.addDevCount = 0;
            this.managerData.devData = f;
            console.log("ValueBean -----------------  参数详情", this.managerData);
        };
        t.prototype.getLvUnLockCount = function (t, e) {
            var o = 0,
                a = this.managerData.devData;
            for (var i in a.devData) t >= a.devData[i].unLockLv && e == a.devData[i].foodId && o++;
            return o;
        };
        t.prototype.getDevObj = function () {
            return TaskLooper.getDevObj();
        };
        t.prototype.checkLoadFood = function () {
            var t = !1;
            if (!this.managerData.allFoodKind) {
                this.parseRoomData();
                this.setChackTask(!0);
                this.resetDevData();
                this.sendCacheData();
                t = !0;
            }
            return t;
        };
        t.prototype.sendCacheData = function () {
            var t = this.managerData.allFoodKind.foodData;
            CacheDataManager.setUpLevelCostData(t);
            CacheDataManager.setFoodDevIndex(this.managerData.allFoodKind.foodOpenIndex);
            CacheDataManager.setStarCount(this.managerData.allFoodKind.maxStarCount);
            CacheDataManager.setStarItemCount(this.managerData.allFoodKind.starItemCount);
            CacheDataManager.setFoodLvToStarIndex(this.managerData.allFoodKind.starlvToIndex);
        };
        t.prototype.parseRoomData = function () {
            var t = {},
                e = CacheDataManager.getLevelChapter(GameDataValue.getLastLv()).obj,
                o = [],
                a = {},
                i = {},
                n = {},
                r = {},
                s = {},
                c = {};
            for (var p in e) {
                var l = "" + e[p].key;
                i[l] || (i[l] = 0);
                c[l] || (c[l] = 1);
                s[l] || (s[l] = []);
                a[l] || (a[l] = {});
                n[l] || (n[l] = {});
                if (!t[l]) {
                    o.push({key: l, lv: 0, curlv: 0});
                    t[l] = [];
                }
                a[l][e[p].level] = c[l];
                for (var d = e[p], u = 0; u < d.length; u++) {
                    var h = d[u];
                    t[l].push(CacheDataManager.getGetCopy(d[u]));
                    i[l] = Math.max(i[l], h.star);
                    h.add_equip && c[l]++;
                    r[l] || (r[l] = {});
                    s[l][h.star] || 0 == s[l][h.star] || (s[l][h.star] = 0 == h.star ? -1 : 0);
                    r[l][h.level] = s[l][h.star];
                    s[l][h.star]++;
                    n[l][h.star] || (n[l][h.star] = 0);
                    n[l][h.star]++;
                }
            }
            var f = {unLockCount: 0, curUnLockCount: 0, maxStarCount: i, starItemCount: n, starlvToIndex: r};
            f.foodData = t;
            for (var p in a) a[p] && (a[p][0] = 0);
            for (var p in n) n[p] && n[p][0]--;
            f.allKey = o;
            f.foodOpenIndex = a;
            this.managerData.allFoodKind = f;
            console.log("ValueBean ----------------- ", this.managerData);
        };
        t.prototype.unLockFoodLvKey = function (t, e) {
            if (this.managerData.allFoodKind && this.managerData.allFoodKind.allKey[t]) {
                var o = this.managerData.allFoodKind.allKey[t].lv,
                    a = this.managerData.allFoodKind.allKey[t].key,
                    i = this.getLvUnLockCount(o, a) - 1,
                    n = this.managerData.allFoodKind.foodData[a].length;
                1 == e && o == n - 1 && AdView.showAd(function () {}, s.AdTypeEm.foodMax);
                if (o >= n) return;
                var r = this.managerData.devData;
                if (i >= 0 && r.foodLockData[a]) {
                    if (r.foodLockData[a] && r.foodLockData[a][i]) {
                        r.foodLockData[a][i].isUnLock = !0;
                        this.managerData.devData.foodUnlockCount[a] = i + 1;
                    }
                    CacheDataManager.setFoodLevelData(a, o + 1);
                }
                this.managerData.allFoodKind.allKey[t].lv++;
                this.managerData.allFoodKind.unLockCount++;
                this.setChackTask(!0);
            }
        };
        t.prototype.getUnLockDev = function (t) {
            return this.managerData.devData.foodUnlockCount[t];
        };
        t.prototype.updateFoodLv = function (t) {
            if (this.managerData.allFoodKind) {
                var e = this.managerData.allFoodKind.allKey;
                for (var o in e)
                    if (e[o].key == t) {
                        this.unLockFoodLvKey(o, 1);
                        break;
                    }
            }
        };
        t.prototype.canUnLockFood = function () {
            var t = this.managerData.allFoodKind;
            return !!(t && t.curUnLockCount < t.unLockCount);
        };
        t.prototype.addUnlockFood = function (t) {
            var e = 0;
            if (this.managerData.allFoodKind && this.managerData.allFoodKind.allKey[t]) {
                var o = this.managerData.allFoodKind.allKey[t].key;
                this.managerData.allFoodKind.curUnLockCount++;
                e = this.managerData.allFoodKind.allKey[t].curlv;
                this.managerData.allFoodKind.allKey[t].curlv++;
                if (this.managerData.allFoodKind.allKey[t].curlv > 1) {
                    this.cookCofData.curLevel++;
                    for (var a = 0; a < this.managerData.allFoodKind.allKey.length; a++)
                        if (this.managerData.allFoodKind.allKey[a].lv < 1) {
                            this.managerData.allFoodKind.allKey[a].lv = 1;
                            this.managerData.allFoodKind.unLockCount++;
                            CacheDataManager.setFoodLevelData(
                                this.managerData.allFoodKind.allKey[a].key,
                                this.managerData.allFoodKind.allKey[a].lv
                            );
                        }
                }
                CacheDataManager.setFoodLevelData(o, e);
                this.setChackTask(!0);
            }
            return e;
        };
        t.prototype.getCurLevel = function () {
            return this.cookCofData.curLevel;
        };
        t.prototype.getMaxLevel = function () {
            return this.cookCofData.maxLevel;
        };
        t.prototype.getFoodIndexData = function (t) {
            var e = "";
            this.managerData.allFoodKind &&
                this.managerData.allFoodKind.allKey[t] &&
                (e = this.managerData.allFoodKind.allKey[t].key);
            return e;
        };
        t.prototype.getNewUnLockFoodKey = function () {
            var t = "";
            if (this.managerData.allFoodKind) {
                var e = this.managerData.allFoodKind.allKey;
                for (var o in e)
                    if (e[o].curlv < e[o].lv) {
                        t = o;
                        break;
                    }
            }
            return t;
        };
        t.prototype.getUnlockFoodLv = function (t) {
            var e = 0;
            this.managerData.allFoodKind &&
                this.managerData.allFoodKind.allKey[t] &&
                (e = this.managerData.allFoodKind.allKey[t].curlv);
            return e;
        };
        t.prototype.getWayCountIndex = function () {
            return this.wayRoad.getWayCountIndex();
        };
        t.prototype.reduceWaitCount = function () {
            this.wayRoad.reduceWaitCount();
        };
        t.prototype.getWayTask = function (t, e, o) {
            var i = [];
            this.wayRoad.setRoadCatRoad(t, e, !0);
            i.push(this.getTaskData(o, "", a.Cat0Index.moveWalk, t, e, this.wayRoad.getIndexPath(t, !0)));
            i.push(this.getTaskData(o, "", a.Cat0Index.waitFood, t, e, null));
            i.push(this.getTaskData(o, "", a.Cat0Index.moveOverFood, t, e, this.wayRoad.getIndexPath(t, !1)));
            return i;
        };
        t.prototype.getCarWayTask = function (t, e, o) {
            var i = [];
            this.wayRoad.setRoadCatRoad(t, e, !0);
            var n = this.wayRoad.getWaitCount();
            this.wayRoad.addWaitCount();
            var r = this.wayRoad.getIndexPath(t, !0);
            i.push(this.getTaskData(o, o, a.Cat0Index.moveWalk, t, e, r));
            i.push(this.getTaskData(o, o, a.Cat0Index.checkNextMove, t, e, null, 0));
            i.push(this.getTaskData(o, o, a.Cat0Index.waitMove, t, e, null));
            var s = this.wayRoad.getWaitMove();
            i.push(this.getTaskData(o, o, a.Cat0Index.carMoveWay, t, n, s, 1));
            i.push(this.getTaskData(o, o, a.Cat0Index.checkNextMove, t, e, null, 1));
            i.push(this.getTaskData(o, o, a.Cat0Index.waitFood, t, n, null));
            i.push(this.getTaskData(o, o, a.Cat0Index.moveOverFood, t, e, this.wayRoad.getIndexPath(t, !1)));
            return i;
        };
        t.prototype.getTaskData = function (t, e, o, a, i, n, r, s, c, p, l, d) {
            void 0 === r && (r = -1);
            void 0 === s && (s = 1);
            void 0 === c && (c = null);
            void 0 === p && (p = 0);
            void 0 === l && (l = -1);
            void 0 === d && (d = -1);
            var u = TaskLooper.getTask();
            u.task = o;
            u.index = a;
            u.cs = i;
            u.path = n;
            u.toId = r;
            u.toId2 = l;
            u.startToPos = c;
            u.waitTime = p;
            u.toTab2Index = d;
            u.count = s;
            u.aren = t;
            u.toAren = e;
            u.cookMul = 1;
            return u;
        };
        t.prototype.openNewCooking = function (t) {
            this.timeObj[t] = Date.now();
        };
        t.prototype.getKeyTime = function (t) {
            return this.timeObj[t];
        };
        t.prototype.loadLevelCof = function () {};
        t.prototype.getCurMaxCatCount = function () {
            return this.cookCofData.baseCatCount + this.cookCofData.addCatCount;
        };
        t.prototype.getCurMaxCarCount = function () {
            return this.cookCofData.baseCarCount + this.cookCofData.addCarCount;
        };
        t.prototype.addRoadCat = function (t) {
            this.cookCofData.addCatCount += t;
        };
        t.prototype.addRoadCar = function (t) {
            this.cookCofData.addCarCount += t;
        };
        t.prototype.addNpcCat = function (t) {
            this.cookCofData.addNpcCount += t;
        };
        t.prototype.getCurMaxNpcCount = function () {
            return this.cookCofData.baseNpcCount + this.cookCofData.addNpcCount;
        };
        t.prototype.setBaseNpcCount = function (t) {
            this.cookCofData.baseNpcCount = t;
        };
        t.prototype.canEnterNextCat = function () {
            return this.cookData.curCatCount < this.getCurMaxCatCount() && this.cookData.lastMakeTime > 2;
        };
        t.prototype.canEnterNextCar = function () {
            return this.cookData.curCarCount < this.getCurMaxCarCount() && this.cookData.lastMakeTime > 5;
        };
        t.prototype.canMakeNpcBox = function () {
            return this.cookData.curNpcCat + this.cookData.npcBoxCount < this.getCurMaxNpcCount();
        };
        t.prototype.canWaitNpcTask = function () {
            return this.managerData.roadCatTaskList.length > 0;
        };
        t.prototype.canCookingRoadCat = function () {
            for (var t = !0, e = 0; e < this.managerData.callTable.length && t; e++)
                for (var o = this.managerData.callTable[e].foodData.foodKindCountList, i = 0; i < o.length; i++) {
                    var n = o[i].id,
                        r = this.managerData.devData.foodLockData[n],
                        s = this.getDevAren(n);
                    if (!(this.getTaskNpc(a.Cat0Index.continueWait, s) < 0) && r)
                        for (var c = 0; c < r.length && t; c++) r[c].isUnLock && !r[c].isuse && (t = !1);
                }
            return !t;
        };
        t.prototype.getWaitNpcTask = function () {
            return this.managerData.roadCatTaskList.shift();
        };
        t.prototype.getTaskNpc = function (t, e) {
            var o = -1;
            for (var a in this.managerData.npcUseCatStatus)
                if (this.managerData.npcUseCatStatus[a].status == t && this.managerData.npcUseCatStatus[a].aren == e) {
                    o = this.managerData.npcUseCatStatus[a].id;
                    break;
                }
            return o;
        };
        t.prototype.getMoveToDlgNpcId = function () {
            for (var t = -1, e = 0; e < this.managerData.roadCatTaskList.length; e++) {
                var o = this.managerData.roadCatTaskList[e],
                    i = this.getRoadCatTabIndexKey(o.aren);
                for (var n in this.managerData.npcUseCatStatus) {
                    var r = this.managerData.npcUseCatStatus;
                    if (r[n].status == a.Cat0Index.continueWait && i == r[n].aren)
                        return this.managerData.npcUseCatStatus[n].id;
                }
            }
            return t;
        };
        t.prototype.getDevArenData = function () {};
        t.prototype.getMoveToChangeFoodNpcId = function () {
            var t = -1,
                e = this.getRoadCatTabIndexKey("0");
            for (var o in this.managerData.npcUseCatStatus) {
                var i = this.managerData.npcUseCatStatus;
                if (i[o].status == a.Cat0Index.continueWait && e == i[o].aren)
                    return this.managerData.npcUseCatStatus[o].id;
            }
            return t;
        };
        t.prototype.getNpcMoveToDlgTask = function (t, e, o, i, n) {
            this.npcRoad.moveToMainDis(i);
            var r = this.npcRoad.getRoadPos(t);
            if (i.sub(r).mag() < 150) return this.getTaskData("", n, a.Cat0Index.moveToDlg, t, e, null, o, 1, r);
            var s = this.npcRoad.getMinNpcTabPath(t, i);
            return s.length > 0
                ? this.getTaskData("", n, a.Cat0Index.moveToDlg, t, e, s, o, 1, null)
                : this.getTaskData("", n, a.Cat0Index.moveToDlg, t, e, null, o, 1, r);
        };
        t.prototype.getNpcDlgTask = function (t, e, o, i) {
            var n = Math.max(0.1, 1 - CacheDataManager.getAddAllAddtion(a.AddtionData.ddsd));
            return this.getTaskData("", i, a.Cat0Index.dlg, t, e, null, o, 1, cc.v2(this.npcRoad.getRoadPos(t)), n);
        };
        t.prototype.npcCheckBool = function () {
            return this.cookData.canCheckTabTask;
        };
        t.prototype.addNpcCount = function () {
            this.cookData.npcBoxCount++;
            var t = [];
            t.push(this.getNpcContinueWaitTask(""));
            this.setChackTask(!0);
            return t;
        };
        t.prototype.addNpcInvateCount = function () {
            var t = [];
            t.push(this.getNpcContinueWaitTask(""));
            this.setChackTask(!0);
            return t;
        };
        t.prototype.setChackTask = function (t) {
            this.cookData.canCheckTabTask = t;
        };
        t.prototype.getNpcContinueWaitTask = function (t) {
            return this.getTaskData("", t, a.Cat0Index.continueWait, 0, 0, null);
        };
        t.prototype.setNpcIdStatus = function (t, e, o) {
            this.managerData.npcUseCatStatus[t] || (this.managerData.npcUseCatStatus[t] = {id: t, status: e, aren: o});
            this.managerData.npcUseCatStatus[t].id = t;
            this.managerData.npcUseCatStatus[t].status = e;
            "" != o && (this.managerData.npcUseCatStatus[t].aren = o);
        };
        t.prototype.addFirstCat = function (t) {
            if (this.isFirst) {
                this.isFirst = !1;
                CacheDataManager.setCacheCatId(t + "");
            }
        };
        t.prototype.getCurDevFoodData = function () {
            var t = CacheDataManager.getLevelChapter(GameDataValue.getLastLv());
            if (t && t.obj) {
                var e = t.obj,
                    o = [];
                for (var a in e) t.obj[a] && o.push(t.obj[a].key);
                return o;
            }
            return null;
        };
        t.prototype.reduceNpcBox = function () {
            this.cookData.curNpcCat++;
            this.cookData.npcBoxCount--;
        };
        t.prototype.addNewCatTime = function (t) {
            this.cookData.lastMakeTime += t;
        };
        t.prototype.resetNewCatTime = function () {
            this.cookData.lastMakeTime = 0;
        };
        t.prototype.addCurCatCount = function () {
            this.cookData.curCatCount++;
        };
        t.prototype.recCurRoadCatCount = function () {
            this.cookData.curCatCount--;
        };
        t.prototype.addCurCarCount = function () {
            this.cookData.curCarCount++;
        };
        t.prototype.recCurRoadCarCount = function () {
            this.cookData.curCarCount--;
        };
        return t;
    })();
o.default = d;
